<template>
  <div class="home">
    <!--在全局引入声明过可以直接使用-->
    <ly-tab
      class="fix"
      @change="handleChange"
      v-model="selectedId"
      :options="options"
      :items="items"></ly-tab>
    <router-view></router-view>
  </div>
</template>

<script>
    export default {
        name: 'Home',
        data(){
          return {
            selectedId:0, // ly-tab选中的id,默认为0
            items:[        // ly-tab中的数据
              {label:'热门'},
              {label:'服饰'},
              {label:'鞋包'},
              {label:'母婴'},
              {label:'百货'},
              {label:'食品'},
              {label:'内衣'},
              {label:'男装'},
              {label:'电器'}
            ],
            options:{
              activeColor:'#e9232c' // 设置ly-tab选中的颜色
            },
            // 二级路由路径数组
            subRouterUrl: [
              '/home/hot','/home/dress','/home/box','/home/mbaby','/home/general','/home/food','/home/shirt','/home/man','/home/ele'
            ]
          }
        },
        methods:{
          handleChange(item,index){
            this.$router.replace(this.subRouterUrl[index]);
          }
        }
    }
</script>

<style scoped lang="stylus" ref="stylesheet/stylus">
  .fix
    position fixed
    left 0
    top: 0
    z-index 998
</style>
